/*
 * @FilePath: main.js
 * @Author: 杜芬
 * @Date: 2021-10-25 15:59:45
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-09-25 16:46:48
 * Copyright: 2022 xxxTech CO.,LTD. All Rights Reserved.
 * @Descripttion: 页面
 */
import Vue from 'vue';

import 'normalize.css/normalize.css'; // A modern alternative to CSS resets

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import locale from 'element-ui/lib/locale/lang/en'; // lang i18n

import '@/styles/index.scss'; // global css
import * as echarts from 'echarts';
import App from './App';
import store from './store';
import router from './router';
// 将自动注册所有组件为全局组件
import dataV from '@jiaminghi/data-view';

import '@/icons'; // icon
import '@/permission'; // permission control
// 导入时间包 dayjs
import * as dayjs from 'dayjs';
import * as isLeapYear from 'dayjs/plugin/isLeapYear'; // import plugin
import 'dayjs/locale/zh-cn'; // import locale

// 注册全局指令
// Vue.directive('focus', {
//   inserted(el) {
//     // el 指令绑定的元素
//     el.focus();
//   },
// });

dayjs.extend(isLeapYear); // use plugin
dayjs.locale('zh-cn'); // use locale

if (process.env.NODE_ENV === 'production') {
  const { mockXHR } = require('../mock');
  mockXHR();
}

Vue.use(dataV);
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale }); // 英文版
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI);
Vue.prototype.$echarts = echarts;
Vue.config.productionTip = false;

new Vue({
  el: '#app',
  router,
  store,
  render: (h) => h(App),
});
